Validate SRS voice packet framing in decoder - #721
Merged
Conversation
Decode trusted the packet-length header over the datagram, so a corrupt or truncated packet whose header still pointed within bounds could decode into a plausible-looking packet with a garbage OriginGUID. A downstream receiver would then treat it as a real transmitter capable of holding a frequency. Cross-checked against a packet captured on a live SRS server (eu.limakilo.net) to confirm the new validation doesn't reject real traffic. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
dharmab
force-pushed
the
fix/voice-decode-framing-validation
branch
from
July 26, 2026 20:30
c7c0469 to
c35096b
Compare
dharmab
enabled auto-merge (rebase)
July 26, 2026 20:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Split off from #712.
voice.Decodetrusted the packet-length header over the datagram: it readpacketLengthfrom the first two bytes and then worked backwards from that offset without ever checking that the offset was consistent with the actual datagram or with the declared segment lengths.A corrupt or truncated packet whose header still happened to point within bounds could decode into a plausible-looking
Packetwith a garbageOriginGUID. A receiver consuming that packet would treat it as a real transmitter capable of holding a frequency.Change
Decodenow rejects a packet if:Verified against a live server
Cross-checked the new validation against a packet captured on
eu.limakilo.net(receive only, never transmitted) carrying four frequencies: header 6 + audio 31 + frequencies 40 + fixed 58 = 135 bytes, matching the datagram size.TestDecodeMatchesObservedFramingpins this.Testing
New tests: round-trip encode/decode across single/multiple/encrypted/no-audio frequency sets, the observed-framing regression above, and rejection of truncated datagrams, mismatched length headers, and inconsistent segment lengths.
🤖 Generated with Claude Code